//-----------------------------------------------------------------------
// <copyright file="IEventTopic.cs" company="iron9light">
//      Copyright (c) iron9light. All rights reserved.
// </copyright>
// <author>iron9light</author>
//-----------------------------------------------------------------------

namespace EventBroker
{
    using System;

    public interface IEventTopic : IDisposable
    {
        /// <summary>
        /// Gets the topic name.
        /// </summary>
        string Name
        {
            get;
        }

        /// <summary>
        /// Gets the count of registered publications with this <see cref="EventTopic"/>.
        /// </summary>
        int PublicationCount
        {
            get;
        }

        /// <summary>
        /// Gets the count of registered subscriptions to this <see cref="EventTopic"/>.
        /// </summary>
        int SubscriptionCount
        {
            get;
        }

        /// <summary>
        /// Adds a publication to the topic.
        /// </summary>
        /// <param name="publication">The publication.</param>
        void AddPublication(IPublication publication);

        /// <summary>
        /// Removes a publication from this <see cref="EventTopic"/>.
        /// </summary>
        /// <param name="publisher">The object that contains the publication.</param>
        /// <param name="eventName">The name of event on the publisher that fires the topic.</param>
        void RemovePublication(object publisher, string eventName);

        /// <summary>
        /// Removes all publications of the publisher from this <see cref="EventTopic"/>.
        /// </summary>
        /// <param name="publisher">The object that contains the publication.</param>
        void RemovePublisher(object publisher);

        /// <summary>
        /// Adds a subcription to this <see cref="EventTopic"/>.
        /// </summary>
        /// <param name="subscription">The subscription.</param>
        void AddSubscription(ISubscription subscription);

        /// <summary>
        /// Removes a subscription from this <see cref="EventTopic"/>.
        /// </summary>
        /// <param name="subscriber">The object that contains the method that will handle the <see cref="EventTopic"/>.</param>
        /// <param name="handlerMethodName">The name of the method on the subscriber that will handle the <see cref="EventTopic"/>.</param>
        void RemoveSubscription(object subscriber, string handlerMethodName);

        /// <summary>
        /// Removes all subscriptions of the subscriber from this <see cref="EventTopic"/>.
        /// </summary>
        /// <param name="subscriber">The object that contains the method that will handle the <see cref="EventTopic"/>.</param>
        void RemoveSubscription(object subscriber);

        /// <summary>
        /// Fires the specified publication.
        /// </summary>
        /// <param name="publication">The publication.</param>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void Fire(IPublication publication, object sender, EventArgs e);
    }
}